package com.starchen.optimalselection.web.controller;

import com.starchen.optimalselection.common.utils.Result;
import com.starchen.optimalselection.common.model.Category;
import com.starchen.optimalselection.web.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author daxilong
 * @date 2025/4/9 22:06
 */
@Api(tags = "商品分类")
@RestController
@RequestMapping("api/category")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @ApiOperation("获取一级分类")
    @GetMapping(value = "onelevel")
    public Result oneCategoryList() {
        List<Category> productList = categoryService.getOneLevelCategory();
        return Result.success(productList);
    }

    //查询所有分类
//    @GetMapping("all")
//    public Result categoryList() {
//        List<Category> categoryList = categoryService.getTreeList();
//        return Result.success(categoryList);
//    }
}
